﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Conference.Command.Command;
using FluentValidation;

namespace ConferenceWebApi.Models
{
    /// <summary>
    /// 创建客户
    /// </summary>
    public class CreateCustomerDto
    {
        /// <summary>
        /// 客户姓名
        /// </summary>
        public string CustomerName { get; set; }
        /// <summary>
        /// 客户年龄
        /// </summary>
        public string CustomerAge { get; set; }
        /// <summary>
        /// 客户电话
        /// </summary>
        public string CustomerPhone { get; set; }
        /// <summary>
        /// 客户地址
        /// </summary>
        public Address CustomerAddress { get; set; }
    }

    /// <summary>
    /// 验证
    /// </summary>
    public class CreateCustomerDtoValidator : AbstractValidator<CreateCustomerDto>
    {
        public CreateCustomerDtoValidator()
        {
            RuleFor(x => x.CustomerName)
                  .NotEmpty()
                  .WithMessage("客户姓名不能为空");
            RuleFor(x => x.CustomerPhone)
                  .NotEmpty()
                  .WithMessage("客户电话不能为空");

        }
    }

}
